package com.anosine.gpsl.android.util;

import java.io.File;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.anosine.gpsl.android.R;

public class ShowConfirmDlgA {
	private Context context;
	private static Dialog dlg;
    private TextView mTvShowInfo1,tv_show_info_dlg_title;

	/**
	 * 方法名：ShowDownloadProgressDlgA(Context context, UpdataInfoBean info) 功能：初始化
	 * 参数：Context context 上下文, UpdataInfoBean info 更新bean
	 * */
	public ShowConfirmDlgA(Context context, String info,String title) {
		dlg = new Dialog(context, R.style.custom_dlg);
		this.context = context;
		LayoutInflater layout = LayoutInflater.from(context);
		View view = layout
				.inflate(R.layout.dlg_show_confirm, null);
		mTvShowInfo1 = (TextView) view.findViewById(R.id.tv_show_info_dlg_confirm);
        mTvShowInfo1.setText(info);
        tv_show_info_dlg_title=(TextView) view.findViewById(R.id.tv_show_info_dlg_title);
        tv_show_info_dlg_title.setText(title);
        dlg.setContentView(view);
		dlg.setCanceledOnTouchOutside(false);	
        WindowManager.LayoutParams layoutParams = dlg.getWindow().getAttributes();
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        int mScreenWidth = wm.getDefaultDisplay().getWidth();
        layoutParams.width = (int) (0.9f * mScreenWidth);			
		dlg.show();
	}

	/**
	 * 文件名：dismiss() 功能：提示框消失 参数：无
	 * 
	 * @return none
	 * */
	public void dismiss() {
		if (dlg != null)
			dlg.dismiss();
	}
		public void show() {
			if (dlg != null)
				dlg.show();
		}
	/**
	 * 文件名：getCancel() 功能：获取提示框 中的取消下载按钮 参数：无
	 * 
	 * @return TextView
	 * */
	public TextView getCancel() {
		return ((TextView) dlg.findViewById(R.id.btn_confirm_dlg_cancel));
	}
	public TextView getOk() {
		return ((TextView) dlg.findViewById(R.id.btn_confirm_dlg_ok));
	}
	
}
